package com.witmore.neutron.ai.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.witmore.neutron.ai.db.entity.AgentSessionRecordDO;
import com.witmore.neutron.ai.web.controller.vo.AgentResult;
import com.witmore.neutron.ai.web.controller.vo.ChatRecordQuery;
import com.witmore.neutron.ai.web.controller.vo.RobotQueryParam;
import com.witmore.neutron.ai.web.service.RobotService;
import com.witmore.neutron.ai.web.service.SessionRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 豆子高
 * @date 2025-05-26 10:44
 */
@Controller
@RequestMapping("")
public class DashboardController {

    @Autowired
    private RobotService robotService;

    @Autowired
    private SessionRecordService sessionRecordService;
    /**
     * 控制台页面
     */
    @GetMapping("/dashboard")
    public String dashboard(Model model, ChatRecordQuery query) {
        List<AgentResult> list = robotService.list(new RobotQueryParam());
        model.addAttribute("agentList", list);

        query.setSize(10);
        Page<AgentSessionRecordDO> recordPageInfo = sessionRecordService.getRecordListPage(query);
        model.addAttribute("recordPageInfo", recordPageInfo);

        return "dashboard";
    }
}
